﻿using CommonCater;
using Lufei_CaterBLL;
using Lufei_CaterModel;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Lufei_CaterUI
{
    public partial class FromAddRoom : Form
    {
        public FromAddRoom()
        {
            InitializeComponent();
        }

      

        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnOk_Click(object sender, EventArgs e)
        {
            RoomInfoBLL bll = new RoomInfoBLL();
            //构造房间对象
            RoomInfo roomInfo = new RoomInfo();
            roomInfo.RoomName = txtRName.Text.Trim();
            roomInfo.RoomType =Convert.ToInt32(txtRType.Text.Trim());
            roomInfo.RoomMinimunConsume = Convert.ToDecimal(txtRMinMoney.Text.Trim());
            roomInfo.RoomMaxConsumer = Convert.ToInt32(txtRPerNum.Text.Trim());
            roomInfo.IsDefault = Convert.ToInt32(txtIsDeflaut.Text.Trim());
            roomInfo.DelFlag =0;
            roomInfo.SubTime = DateTime.Now;
            roomInfo.SubBy = 1;

             bool isInsert=   bll.InserRoom(roomInfo);
            if (isInsert)
            {
                MessageBox.Show("添加房间成功！！！！");
                log<FromAddRoom>.LogDebug("添加房间成功！！！！");
                this.Close();
            }
            else
            {
                MessageBox.Show("添加房间失败！！！！");
                log<FromAddRoom>.LogError("添加房间失败！！！！");
                this.Close();
            }
        }

    }
}
